<template>
  <a-modal title='申请开票(货款发票)' v-model='visible' v-if='visible' width='800px' height='500px' @cancel='handleCancel' @ok='handleSubmit'>
    <f-form ref='form' :action='api.hyorder.updateOrderInvoiceInfo' v-if='visible' :form-key='this.formItem.orderId'>
      <f-form-item label='发票方式' name='invoiceSendType' type='radio' dataType='number' :data='api.busCommon.invoiceSendType' :value.sync='formItem.invoiceSendType' />
      <f-form-item label='发票要求' name='invoiceRemark' :value.sync='formItem.invoiceRemark' />
    </f-form>
  </a-modal>
</template>
<script>
import api from "../../js/api"

export default {
  name: "InvoiceApplyModal",
  props: {},
  data() {
    return {
      refs: this.$refs,
      api: Object.assign(api, this.api),
      loading: false,
      visible: false,
      isAdd: true,//是否是添加模式
      loaded: false,//是否加载完成
      formItem: this.getFormItem(),
      queryParam: {}
    }
  },

  methods: {
    getFormItem() {
      return {}
    },
    open(record) {
      if (record) {
        this.http.get(this, {
          url: this.api.hyorder.get,
          data: {
            orderId: record.orderId,
            handlerName: "hyOrderGetHandler"
          },
          success: function(me, data) {
            me.formItem = data
            me.visible = true
            me.loaded = true
          }
        })
      }
      this.visible = true
    },
    close() {
      this.$emit("close")
      this.visible = false
    },
    handleCancel() {
      this.close()
    },
    handleSubmit() {
      this.$refs["form"].submit({
        orderId: this.formItem.orderId
      }, this.handleSuccess)
    }
  },
  created() {
  },
  components: {}
}
</script>

<style scoped lang='less' rel='stylesheet/less'>

</style>
